<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Spec::Runner::OptionParser</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Spec::Runner::OptionParser</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/runner/option_parser_rb.html">
                vendor/plugins/rspec/lib/spec/runner/option_parser.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000245">create_behaviour_runner</a>&nbsp;&nbsp;
      <a href="#M000244">new</a>&nbsp;&nbsp;
      <a href="#M000246">parse</a>&nbsp;&nbsp;
      <a href="#M000248">parse_drb</a>&nbsp;&nbsp;
      <a href="#M000250">parse_help</a>&nbsp;&nbsp;
      <a href="#M000247">parse_options_file</a>&nbsp;&nbsp;
      <a href="#M000249">parse_version</a>&nbsp;&nbsp;
      <a href="#M000251">set_spec_from_line_number</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">BUILT_IN_FORMATTERS</td>
          <td>=</td>
          <td class="context-item-value">{         'specdoc'  =&gt; Formatter::SpecdocFormatter,         's'        =&gt; Formatter::SpecdocFormatter,         'html'     =&gt; Formatter::HtmlFormatter,         'h'        =&gt; Formatter::HtmlFormatter,         'rdoc'     =&gt; Formatter::RdocFormatter,         'r'        =&gt; Formatter::RdocFormatter,         'progress' =&gt; Formatter::ProgressBarFormatter,         'p'        =&gt; Formatter::ProgressBarFormatter,         'failing_examples' =&gt; Formatter::FailingExamplesFormatter,         'e'        =&gt; Formatter::FailingExamplesFormatter,         'failing_behaviours' =&gt; Formatter::FailingBehavioursFormatter,         'b'        =&gt; Formatter::FailingBehavioursFormatter</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">COMMAND_LINE</td>
          <td>=</td>
          <td class="context-item-value">{         :diff =&gt;    [&quot;-D&quot;, &quot;--diff [FORMAT]&quot;, &quot;Show diff of objects that are expected to be equal when they are not&quot;,                                              &quot;Builtin formats: unified|u|context|c&quot;,                                              &quot;You can also specify a custom differ class&quot;,                                              &quot;(in which case you should also specify --require)&quot;],         :colour =&gt;  [&quot;-c&quot;, &quot;--colour&quot;, &quot;--color&quot;, &quot;Show coloured (red/green) output&quot;],         :example =&gt; [&quot;-e&quot;, &quot;--example [NAME|FILE_NAME]&quot;,  &quot;Execute example(s) with matching name(s). If the argument is&quot;,                                                           &quot;the path to an existing file (typically generated by a previous&quot;,                                                           &quot;run using --format failing_examples:file.txt), then the examples&quot;,                                                           &quot;on each line of thatfile will be executed. If the file is empty,&quot;,                                                           &quot;all examples will be run (as if --example was not specified).&quot;,                                                           &quot; &quot;,                                                           &quot;If the argument is not an existing file, then it is treated as&quot;,                                                           &quot;an example name directly, causing RSpec to run just the example&quot;,                                                           &quot;matching that name&quot;],         :specification =&gt; [&quot;-s&quot;, &quot;--specification [NAME]&quot;, &quot;DEPRECATED - use -e instead&quot;, &quot;(This will be removed when autotest works with -e)&quot;],         :line =&gt; [&quot;-l&quot;, &quot;--line LINE_NUMBER&quot;, Integer, &quot;Execute behaviout or specification at given line.&quot;,                                                        &quot;(does not work for dynamically generated specs)&quot;],         :format =&gt; [&quot;-f&quot;, &quot;--format FORMAT[:WHERE]&quot;,  &quot;Specifies what format to use for output. Specify WHERE to tell&quot;,                                                     &quot;the formatter where to write the output. All built-in formats&quot;,                                                     &quot;expect WHERE to be a file name, and will write to STDOUT if it's&quot;,                                                     &quot;not specified. The --format option may be specified several times&quot;,                                                     &quot;if you want several outputs&quot;,                                                     &quot; &quot;,                                                     &quot;Builtin formats: &quot;,                                                     &quot;progress|p           : Text progress&quot;,                                                     &quot;specdoc|s            : Behaviour doc as text&quot;,                                                     &quot;rdoc|r               : Behaviour doc as RDoc&quot;,                                                     &quot;html|h               : A nice HTML report&quot;,                                                     &quot;failing_examples|e   : Write all failing examples - input for --example&quot;,                                                     &quot;failing_behaviours|b : Write all failing behaviours - input for --example&quot;,                                                     &quot; &quot;,                                                     &quot;FORMAT can also be the name of a custom formatter class&quot;,                                                     &quot;(in which case you should also specify --require to load it)&quot;],         :require =&gt; [&quot;-r&quot;, &quot;--require FILE&quot;, &quot;Require FILE before running specs&quot;,                                           &quot;Useful for loading custom formatters or other extensions.&quot;,                                           &quot;If this option is used it must come before the others&quot;],         :backtrace =&gt; [&quot;-b&quot;, &quot;--backtrace&quot;, &quot;Output full backtrace&quot;],         :loadby =&gt; [&quot;-L&quot;, &quot;--loadby STRATEGY&quot;, &quot;Specify the strategy by which spec files should be loaded.&quot;,                                               &quot;STRATEGY can currently only be 'mtime' (File modification time)&quot;,                                               &quot;By default, spec files are loaded in alphabetical order if --loadby&quot;,                                               &quot;is not specified.&quot;],         :reverse =&gt; [&quot;-R&quot;, &quot;--reverse&quot;, &quot;Run examples in reverse order&quot;],         :timeout =&gt; [&quot;-t&quot;, &quot;--timeout FLOAT&quot;, &quot;Interrupt and fail each example that doesn't complete in the&quot;,                                               &quot;specified time&quot;],         :heckle =&gt; [&quot;-H&quot;, &quot;--heckle CODE&quot;, &quot;If all examples pass, this will mutate the classes and methods&quot;,                                            &quot;identified by CODE little by little and run all the examples again&quot;,                                            &quot;for each mutation. The intent is that for each mutation, at least&quot;,                                            &quot;one example *should* fail, and RSpec will tell you if this is not the&quot;,                                            &quot;case. CODE should be either Some::Module, Some::Class or&quot;,                                            &quot;Some::Fabulous#method}&quot;],         :dry_run =&gt; [&quot;-d&quot;, &quot;--dry-run&quot;, &quot;Invokes formatters without executing the examples.&quot;],         :options_file =&gt; [&quot;-O&quot;, &quot;--options PATH&quot;, &quot;Read options from a file&quot;],         :generate_options =&gt; [&quot;-G&quot;, &quot;--generate-options PATH&quot;, &quot;Generate an options file for --options&quot;],         :runner =&gt; [&quot;-U&quot;, &quot;--runner RUNNER&quot;, &quot;Use a custom BehaviourRunner.&quot;],         :drb =&gt; [&quot;-X&quot;, &quot;--drb&quot;, &quot;Run examples via DRb. (For example against script/spec_server)&quot;],         :version =&gt; [&quot;-v&quot;, &quot;--version&quot;, &quot;Show version&quot;],         :help =&gt; [&quot;-h&quot;, &quot;--help&quot;, &quot;You're looking at it&quot;]</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000244" class="method-detail">
        <a name="M000244"></a>

        <div class="method-heading">
          <a href="#M000244" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000244-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000244-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 82</span>
82:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
83:         <span class="ruby-ivar">@spec_parser</span> = <span class="ruby-constant">SpecParser</span>.<span class="ruby-identifier">new</span>
84:         <span class="ruby-ivar">@file_factory</span> = <span class="ruby-constant">File</span>
85:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000245" class="method-detail">
        <a name="M000245"></a>

        <div class="method-heading">
          <a href="#M000245" class="method-signature">
          <span class="method-name">create_behaviour_runner</span><span class="method-args">(args, err, out, warn_if_no_files)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000245-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000245-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 87</span>
87:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_behaviour_runner</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">err</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">warn_if_no_files</span>)
88:         <span class="ruby-identifier">options</span> = <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">err</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">warn_if_no_files</span>)
89:         <span class="ruby-comment cmt"># Some exit points in parse (--generate-options, --drb) don't return the options, </span>
90:         <span class="ruby-comment cmt"># but hand over control. In that case we don't want to continue.</span>
91:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Options</span>)
92:         <span class="ruby-identifier">options</span>.<span class="ruby-identifier">configure</span>
93:         <span class="ruby-identifier">options</span>.<span class="ruby-identifier">behaviour_runner</span>
94:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000246" class="method-detail">
        <a name="M000246"></a>

        <div class="method-heading">
          <a href="#M000246" class="method-signature">
          <span class="method-name">parse</span><span class="method-args">(args, err, out, warn_if_no_files)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000246-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000246-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 96</span>
 96:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">err</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">warn_if_no_files</span>)
 97:         <span class="ruby-identifier">options_file</span> = <span class="ruby-keyword kw">nil</span>
 98:         <span class="ruby-identifier">args_copy</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">dup</span>
 99:         <span class="ruby-identifier">options</span> = <span class="ruby-constant">Options</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">err</span>, <span class="ruby-identifier">out</span>)
100: 
101:         <span class="ruby-identifier">opts</span> = <span class="ruby-operator">::</span><span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
102:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-value str">&quot;Usage: spec (FILE|DIRECTORY|GLOB)+ [options]&quot;</span>
103:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">separator</span> <span class="ruby-value str">&quot;&quot;</span>
104: 
105:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
106:             <span class="ruby-identifier">on</span>(<span class="ruby-operator">*</span><span class="ruby-constant">COMMAND_LINE</span>[<span class="ruby-identifier">name</span>], <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
107:           <span class="ruby-keyword kw">end</span>
108: 
109:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:diff</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">diff</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_diff</span>(<span class="ruby-identifier">diff</span>)}
110: 
111:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:colour</span>) {<span class="ruby-identifier">options</span>.<span class="ruby-identifier">colour</span> = <span class="ruby-keyword kw">true</span>}
112: 
113:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:example</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">example</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_example</span>(<span class="ruby-identifier">example</span>)}
114: 
115:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:specification</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">example</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_example</span>(<span class="ruby-identifier">example</span>)}
116: 
117:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:line</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">line_number</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">line_number</span> = <span class="ruby-identifier">line_number</span>.<span class="ruby-identifier">to_i</span>}
118: 
119:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:format</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_format</span>(<span class="ruby-identifier">format</span>)}
120: 
121:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:require</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">req</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_require</span>(<span class="ruby-identifier">req</span>)}
122: 
123:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:backtrace</span>) {<span class="ruby-identifier">options</span>.<span class="ruby-identifier">backtrace_tweaker</span> = <span class="ruby-constant">NoisyBacktraceTweaker</span>.<span class="ruby-identifier">new</span>}
124: 
125:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:loadby</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">loadby</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">loadby</span> = <span class="ruby-identifier">loadby</span>}
126: 
127:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:reverse</span>) {<span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword kw">true</span>}
128: 
129:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:timeout</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">timeout</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-identifier">timeout</span>.<span class="ruby-identifier">to_f</span>}
130: 
131:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:heckle</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">heckle</span><span class="ruby-operator">|</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_heckle</span>(<span class="ruby-identifier">heckle</span>)}
132:           
133:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:dry_run</span>) {<span class="ruby-identifier">options</span>.<span class="ruby-identifier">dry_run</span> = <span class="ruby-keyword kw">true</span>}
134: 
135:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:options_file</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">options_file</span><span class="ruby-operator">|</span>
136:             <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse_options_file</span>(<span class="ruby-identifier">options_file</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">err</span>, <span class="ruby-identifier">args_copy</span>, <span class="ruby-identifier">warn_if_no_files</span>)
137:           <span class="ruby-keyword kw">end</span>
138: 
139:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:generate_options</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">options_file</span><span class="ruby-operator">|</span>
140:             <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_generate_options</span>(<span class="ruby-identifier">options_file</span>, <span class="ruby-identifier">args_copy</span>, <span class="ruby-identifier">out</span>)
141:           <span class="ruby-keyword kw">end</span>
142: 
143:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:runner</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">runner</span><span class="ruby-operator">|</span>
144:             <span class="ruby-identifier">options</span>.<span class="ruby-identifier">runner_arg</span> = <span class="ruby-identifier">runner</span>
145:           <span class="ruby-keyword kw">end</span>
146: 
147:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:drb</span>) <span class="ruby-keyword kw">do</span>
148:             <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse_drb</span>(<span class="ruby-identifier">args_copy</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">err</span>, <span class="ruby-identifier">warn_if_no_files</span>)
149:           <span class="ruby-keyword kw">end</span>
150: 
151:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">rspec_on</span>(<span class="ruby-identifier">:version</span>) {<span class="ruby-identifier">parse_version</span>(<span class="ruby-identifier">out</span>)}
152: 
153:           <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on_tail</span>(<span class="ruby-operator">*</span><span class="ruby-constant">COMMAND_LINE</span>[<span class="ruby-identifier">:help</span>]) {<span class="ruby-identifier">parse_help</span>(<span class="ruby-identifier">opts</span>, <span class="ruby-identifier">out</span>)}
154:         <span class="ruby-keyword kw">end</span>
155:         <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">parse!</span>(<span class="ruby-identifier">args</span>)
156: 
157:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">warn_if_no_files</span>
158:           <span class="ruby-identifier">err</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;No files specified.&quot;</span>
159:           <span class="ruby-identifier">err</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
160:           <span class="ruby-identifier">exit</span>(<span class="ruby-value">6</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">err</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stderr</span>
161:         <span class="ruby-keyword kw">end</span>
162: 
163:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">line_number</span>
164:           <span class="ruby-identifier">set_spec_from_line_number</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">err</span>)
165:         <span class="ruby-keyword kw">end</span>
166: 
167:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">formatters</span>.<span class="ruby-identifier">empty?</span>
168:           <span class="ruby-identifier">options</span>.<span class="ruby-identifier">formatters</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Formatter</span><span class="ruby-operator">::</span><span class="ruby-constant">ProgressBarFormatter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">out</span>)
169:         <span class="ruby-keyword kw">end</span>
170: 
171:         <span class="ruby-identifier">options</span>
172:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000248" class="method-detail">
        <a name="M000248"></a>

        <div class="method-heading">
          <a href="#M000248" class="method-signature">
          <span class="method-name">parse_drb</span><span class="method-args">(args_copy, out_stream, error_stream, warn_if_no_files)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000248-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000248-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 184</span>
184:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_drb</span>(<span class="ruby-identifier">args_copy</span>, <span class="ruby-identifier">out_stream</span>, <span class="ruby-identifier">error_stream</span>, <span class="ruby-identifier">warn_if_no_files</span>)
185:         <span class="ruby-comment cmt"># Remove the --drb option</span>
186:         <span class="ruby-identifier">index</span> = <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;-X&quot;</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;--drb&quot;</span>)
187:         <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">index</span>)
188: 
189:         <span class="ruby-keyword kw">return</span> <span class="ruby-constant">DrbCommandLine</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">args_copy</span>, <span class="ruby-identifier">error_stream</span>, <span class="ruby-identifier">out_stream</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">warn_if_no_files</span>)
190:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000250" class="method-detail">
        <a name="M000250"></a>

        <div class="method-heading">
          <a href="#M000250" class="method-signature">
          <span class="method-name">parse_help</span><span class="method-args">(opts, out_stream)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000250-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000250-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 197</span>
197:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_help</span>(<span class="ruby-identifier">opts</span>, <span class="ruby-identifier">out_stream</span>)
198:         <span class="ruby-identifier">out_stream</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
199:         <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">out_stream</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stdout</span>
200:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000247" class="method-detail">
        <a name="M000247"></a>

        <div class="method-heading">
          <a href="#M000247" class="method-signature">
          <span class="method-name">parse_options_file</span><span class="method-args">(options_file, out_stream, error_stream, args_copy, warn_if_no_files)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000247-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000247-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 174</span>
174:       <span class="ruby-keyword kw">def</span>  <span class="ruby-identifier">parse_options_file</span><span class="ruby-identifier">parse_options_file</span>(<span class="ruby-identifier">options_file</span>, <span class="ruby-identifier">out_stream</span>, <span class="ruby-identifier">error_stream</span>, <span class="ruby-identifier">args_copy</span>, <span class="ruby-identifier">warn_if_no_files</span>)
175:         <span class="ruby-comment cmt"># Remove the --options option and the argument before writing to file</span>
176:         <span class="ruby-identifier">index</span> = <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;-O&quot;</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;--options&quot;</span>)
177:         <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">index</span>)
178:         <span class="ruby-identifier">args_copy</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">index</span>)
179: 
180:         <span class="ruby-identifier">new_args</span> = <span class="ruby-identifier">args_copy</span> <span class="ruby-operator">+</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">options_file</span>).<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">split</span> <span class="ruby-value str">&quot; &quot;</span>}.<span class="ruby-identifier">flatten</span>
181:         <span class="ruby-keyword kw">return</span> <span class="ruby-constant">CommandLine</span>.<span class="ruby-identifier">run</span>(<span class="ruby-identifier">new_args</span>, <span class="ruby-identifier">error_stream</span>, <span class="ruby-identifier">out_stream</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">warn_if_no_files</span>)
182:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000249" class="method-detail">
        <a name="M000249"></a>

        <div class="method-heading">
          <a href="#M000249" class="method-signature">
          <span class="method-name">parse_version</span><span class="method-args">(out_stream)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000249-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000249-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 192</span>
192:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_version</span>(<span class="ruby-identifier">out_stream</span>)
193:         <span class="ruby-identifier">out_stream</span>.<span class="ruby-identifier">puts</span> <span class="ruby-operator">::</span><span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">VERSION</span><span class="ruby-operator">::</span><span class="ruby-constant">DESCRIPTION</span>
194:         <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">out_stream</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stdout</span>
195:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000251" class="method-detail">
        <a name="M000251"></a>

        <div class="method-heading">
          <a href="#M000251" class="method-signature">
          <span class="method-name">set_spec_from_line_number</span><span class="method-args">(options, args, err)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000251-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000251-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/runner/option_parser.rb, line 202</span>
202:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_spec_from_line_number</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">err</span>)
203:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">examples</span>.<span class="ruby-identifier">empty?</span>
204:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
205:             <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@file_factory</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
206:               <span class="ruby-identifier">source</span> = <span class="ruby-ivar">@file_factory</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
207:               <span class="ruby-identifier">example</span> = <span class="ruby-ivar">@spec_parser</span>.<span class="ruby-identifier">spec_name_for</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">line_number</span>)
208:               <span class="ruby-identifier">options</span>.<span class="ruby-identifier">parse_example</span>(<span class="ruby-identifier">example</span>)
209:             <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@file_factory</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
210:               <span class="ruby-identifier">err</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;You must specify one file, not a directory when using the --line option&quot;</span>
211:               <span class="ruby-identifier">exit</span>(<span class="ruby-value">1</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">err</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stderr</span>
212:             <span class="ruby-keyword kw">else</span>
213:               <span class="ruby-identifier">err</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{args[0]} does not exist&quot;</span>
214:               <span class="ruby-identifier">exit</span>(<span class="ruby-value">2</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">err</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stderr</span>
215:             <span class="ruby-keyword kw">end</span>
216:           <span class="ruby-keyword kw">else</span>
217:             <span class="ruby-identifier">err</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Only one file can be specified when using the --line option: #{args.inspect}&quot;</span>
218:             <span class="ruby-identifier">exit</span>(<span class="ruby-value">3</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">err</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stderr</span>
219:           <span class="ruby-keyword kw">end</span>
220:         <span class="ruby-keyword kw">else</span>
221:           <span class="ruby-identifier">err</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;You cannot use both --line and --example&quot;</span>
222:           <span class="ruby-identifier">exit</span>(<span class="ruby-value">4</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">err</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">$stderr</span>
223:         <span class="ruby-keyword kw">end</span>
224:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>